}
}
+static inline void
+init_projection_matrix (graphene_matrix_t *out_proj,
+ const graphene_rect_t *viewport)
+{
+ graphene_matrix_init_ortho (out_proj,
+ viewport->origin.x,
+ viewport->origin.x + viewport->size.width,
+ viewport->origin.y,
+ viewport->origin.y + viewport->size.height,
+ ORTHO_NEAR_PLANE,
+ ORTHO_FAR_PLANE);
+ graphene_matrix_scale (out_proj, 1, -1, 1);
+}
+
static inline gboolean G_GNUC_PURE
color_matrix_modifies_alpha (GskRenderNode *node)
{
GL_NEAREST, GL_NEAREST,
&pass2_texture_id, &pass2_render_target);
- graphene_matrix_init_ortho (&item_proj,
- 0, texture_to_blur_width, 0, texture_to_blur_height,
- ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
- graphene_matrix_scale (&item_proj, 1, -1, 1);
+ init_projection_matrix (&item_proj,
+ &GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
prev_projection = ops_set_projection (builder, &item_proj);
ops_set_modelview (builder, NULL);
GL_NEAREST, GL_NEAREST,
&texture_id, &render_target);
- graphene_matrix_init_ortho (&item_proj,
- 0, texture_width, 0, texture_height,
- ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
- graphene_matrix_scale (&item_proj, 1, -1, 1);
+ init_projection_matrix (&item_proj,
+ &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
prev_projection = ops_set_projection (builder, &item_proj);
ops_set_modelview (builder, NULL);
}
ops_set_program (builder, &self->programs->color_program);
- graphene_matrix_init_ortho (&item_proj,
- 0, texture_width, 0, texture_height,
- ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
- graphene_matrix_scale (&item_proj, 1, -1, 1);
+ init_projection_matrix (&item_proj,
+ &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
prev_render_target = ops_set_render_target (builder, render_target);
ops_begin (builder, OP_CLEAR);
render_target);
}
- graphene_matrix_init_ortho (&item_proj,
- bounds->origin.x * scale,
- (bounds->origin.x + bounds->size.width) * scale,
- bounds->origin.y * scale,
- (bounds->origin.y + bounds->size.height) * scale,
- ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
- graphene_matrix_scale (&item_proj, 1, -1, 1);
+ init_projection_matrix (&item_proj,
+ &GRAPHENE_RECT_INIT (
+ bounds->origin.x * scale,
+ bounds->origin.y * scale,
+ width, height
+ ));
prev_render_target = ops_set_render_target (builder, render_target);
/* Clear since we use this rendertarget for the first time */
g_assert (gsk_gl_driver_in_frame (self->gl_driver));
- /* Set up the modelview and projection matrices to fit our viewport */
- graphene_matrix_init_ortho (&projection,
- viewport->origin.x,
- viewport->origin.x + viewport->size.width,
- viewport->origin.y,
- viewport->origin.y + viewport->size.height,
- ORTHO_NEAR_PLANE,
- ORTHO_FAR_PLANE);
- graphene_matrix_scale (&projection, 1, -1, 1);
-
removed = g_ptr_array_new ();
gsk_gl_texture_atlases_begin_frame (self->atlases, removed);
gsk_gl_glyph_cache_begin_frame (self->glyph_cache, self->gl_driver, removed);
gsk_gl_shadow_cache_begin_frame (&self->shadow_cache, self->gl_driver);
g_ptr_array_unref (removed);
+ /* Set up the modelview and projection matrices to fit our viewport */
+ init_projection_matrix (&projection, viewport);
ops_set_projection (&self->op_builder, &projection);
ops_set_viewport (&self->op_builder, viewport);
ops_set_modelview (&self->op_builder, gsk_transform_scale (NULL, scale_factor, scale_factor));